<%--
 *  File:    ApprovalFailContactSummary.jsp
 *  @Author: Saraxia 
 *  Date:    2012/11/20
 *
 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval. 
--%>      
 

<%@ include file="/inc/SessionTimeout.inc"%>   
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<% //--------------------------------------  setting logger --%>
<%
  	Category cat = Category.getInstance("jsp.ApprovalFailContactSummary"); 
%>

<% //--------------------------------------  variant and initialization --%>
<%
    String strModuleName = "PCM";
  	String strTableName = "";
  	String privilegeCode = "116";
    String contextPath = request.getContextPath(); 
%>



<%
  	HashMap CurUserInfo = (HashMap)session.getAttribute("userinfo");

%>

<% //--------------------------------------  include files list --%>
<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>


<html>
<head>
<title>ApprovalFailContactSummary</title>
<PageFlow:CheckPageFlow pageName="approvalfailsummary"/>
<% //--------------------------------------  output variant from pageflow --%>
<%
  	Vector userGroupSummary = (Vector)pageContext.getAttribute("ugsummary");
  	if(userGroupSummary == null)
  	{
    	userGroupSummary = new Vector();
  	}
  	
  	Integer zylmdapprovaltype = (Integer)pageContext.getAttribute("zylmdapprovaltype");
  	
%>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath %>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath %>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/FuncLib.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/ScriptLib.js"></script>
<%@ include file="/inc/SummaryDivision.inc" %>
<script>

function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(usergroupsummaryform,actionvalue,orderbyname);
  editform.action = "ApprovalFailContactSummary.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();  
}



function allcheckselect(){
	var allcheck = usergroupsummaryform.allcheck.checked;
	var alldatafile = document.getElementsByName('brandcodes');
	var length = alldatafile.length;
	if(allcheck){
		for(var i = 0 ; i < length;i++){
			alldatafile[i].checked = true;
		}
	}else{
		for(var i = 0 ; i < length;i++){
			alldatafile[i].checked = false;
		}	
	}
}

function page_update(){
	
	    if(isNullChecked(usergroupsummaryform.brandcodes))
	    {
	        alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
	        return;
	    }
	    
		document.usergroupsummaryform.actionname.value = "update";
		document.usergroupsummaryform.target = "_self";
	    isRunning = true;
		document.usergroupsummaryform.submit();
}

function page_agree(){
	
    if(isNullChecked(usergroupsummaryform.brandcodes))
    {
        alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
        return;
    }

	document.usergroupsummaryform.actionname.value = "agree";
	document.usergroupsummaryform.target = "_self";
    isRunning = true;
	document.usergroupsummaryform.submit();
}

function page_disagree(){
	
    if(isNullChecked(usergroupsummaryform.brandcodes))
    {
        alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
        return;
    }

	document.usergroupsummaryform.actionname.value = "disagree";
	document.usergroupsummaryform.target = "_self";
    isRunning = true;
	document.usergroupsummaryform.submit();
}

function page_report(){
	
    if(isNullChecked(usergroupsummaryform.brandcodes))
    {
        alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
        return;
    }

	document.usergroupsummaryform.actionname.value = "report";
	document.usergroupsummaryform.target = "_self";
    isRunning = true;
	document.usergroupsummaryform.submit();
}



</script>


</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
	<% //--------------------------------------  hidden form variant --%>
	<form name="usergroupsummaryform" method="post" action="../../Dispatcher"  target="_parent">
    <input type="hidden" name="pagename" value="approvalfailsummary">
    <input type="hidden" name="actionname">
    <input type="hidden" name="numrows" value="<%=userGroupSummary.size() %>">
    <input type="hidden" name="languagecode" value="<%= strLanguageCode %>">
    <input type="hidden" name="zylmdapprovaltype" value="<%=zylmdapprovaltype %>">
    
	<% //--------------------------------------  page location --%>
	<%@ include file="/inc/PageLocation.inc" %>
	
	<table width="100%" cellspacing="0" cellpadding="0" border="0">
  	<tr> 
    	<td valign="top"> 
    		<table width="100%" border="0" cellspacing="0">
          	<tr><td class="summary_top" ></td></tr>
        	</table>
        </td>
   	</tr>
   	</table>
   
   	<table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" align="center" width="100%" cellpadding="0">
   
   	<% //--------------------------------------  summary header --%>
   	<tr bgcolor="#ACBCCA"  class="deepblue-left" > 
   		<td width="2%"  class="title_center" ><input type="checkbox" name="allcheck" class="normalradio" onclick="allcheckselect();"></td>
       	<td width="11%" class="title_center" ><a href="javascript:page_summary('orderby','zylmdapprovalfailname')"><%= label.getLabelName("L_JournalNum") %></a></td>
       	<td width="11%" class="title_center" ><a href="javascript:page_summary('orderby','username')"><%= label.getLabelName("L_SubmitUser") %></a></td>
       	<td width="11%" class="title_center" ><a href="javascript:page_summary('orderby','creatdate')"><%= label.getLabelName("L_CreatDate") %></a></td>
       	<!-- 
       	<td width="11%" class="title_center" ><a href="javascript:page_summary('orderby','approvalno')"><%= label.getLabelName("L_Num") %></a></td>
       	 -->
       	<td width="11%" class="title_center" ><a href="javascript:page_summary('orderby','statusname')"><%= label.getLabelName("L_ApprovalStatus") %></a></td>
       	<td width="11%" class="title_center" ><a href="javascript:page_summary('orderby','zylmdapprovaltype')"><%= label.getLabelName("L_ApprovalType") %></a></td>
    </tr>

	<% //--------------------------------------  default value definition --%>
    <%
    	int i=1;
        Integer nDefaultzylmdapprovalgroupid = new Integer(-1);               
        String strClassType = new String(); 
        boolean bHasChecked = false;
        String strDefaultIsDisabled="";
        String strDefaultmdapprovalgroupname=""; 
   	%>
   	
    <% //--------------------------------------  loop results --%>
    <logic:iterate id="usergroup" collection="<%= userGroupSummary %>">                      
    	
    <%
    	HashMap userGroupMap = (HashMap)pageContext.getAttribute("usergroup"); 
        String strIsDisabled = "";
        String strIsChecked = "";
            
        if(i%2==0){
            strClassType="td-listrom";
        } else{
            strClassType="none";
        } 
       if(!bHasChecked)
        {
	        strIsChecked = "Checked";                       
            bHasChecked = true;
            nDefaultzylmdapprovalgroupid = (Integer)(userGroupMap.get("zylmdapprovalfailid"));
            strDefaultmdapprovalgroupname= (String)(userGroupMap.get("zylmdapprovalfailname"));    
          	strDefaultIsDisabled = strIsDisabled;            
        }  
       i++;
  	%>
    <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull( strClassType )%>'"   class="<%=JspHelper.filterNull( strClassType )%>">
    	<td width="5%" class="title_center">
        	<input type="checkbox" name="brandcodes" id="brandcodes<%=JspHelper.filterNull(i-1)%>" value="<custom:write name="usergroup" property="zylmdapprovalfailid"/>" class="normalradio" />
        </td>
        <td class="<%=JspHelper.filterNull( strClassType )%>">&nbsp;<a href="ApprovalSummaryContact.jsp?<%= OvalTools.randomURL() %>&zylmdapprovalfailid=<%=JspHelper.filterNull( userGroupMap.get("zylmdapprovalfailid") )%>&zylmdapprovaltype=<%=zylmdapprovaltype %>"><%=JspHelper.filterNull( userGroupMap.get("zylmdapprovalfailname") )%></td>
        <td class="<%=JspHelper.filterNull( strClassType )%>">&nbsp;<%=JspHelper.filterNull( userGroupMap.get("username") )%></td>
        <td class="<%=JspHelper.filterNull( strClassType )%>">&nbsp;<%=JspHelper.filterNull( userGroupMap.get("creatdate") )%></td>
        <!-- 
        <td class="<%=JspHelper.filterNull( strClassType )%>">&nbsp;<%=JspHelper.filterNull( userGroupMap.get("approvalno") )%></td>
         -->
        <td class="<%=JspHelper.filterNull( strClassType )%>">&nbsp;<a href="ApprovalFailRecord.jsp?<%= OvalTools.randomURL() %>&zylmdapprovalfailid=<%=JspHelper.filterNull( userGroupMap.get("zylmdapprovalfailid") )%>&zylmdapprovaltype=<%=zylmdapprovaltype %>"><%=JspHelper.filterNull( userGroupMap.get("statusname") )%></a></td>
        <td class="<%=JspHelper.filterNull( strClassType )%>">&nbsp;<custom:write property="zylmdapprovaltype" dictType="ZylMdApprovalType" nbsp="true" name="usergroup"  /></td>
        <!-- 
        <%=JspHelper.filterNull( userGroupMap.get("zylmdapprovaltype") )%> -->
    </tr>
    </logic:iterate>  
    
    <% //--------------------------------------  default value --%>       
    <input type="hidden" name="zylmdapprovalfailid" value="<%=JspHelper.filterNull( nDefaultzylmdapprovalgroupid )%>">
    <input type="hidden" name="zylmdapprovalfailname" value="<%=JspHelper.filterNull( strDefaultmdapprovalgroupname )%>">
 
          
    <% //--------------------------------------  flipping page --%>
    <%@ include file="/inc/SummaryAction.inc" %>
    </table>
    
    <% //--------------------------------------  page operation button --%>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    	<tr> 
        	<td class="summary_top" ></td>
        </tr>
		<%if(privilegeSet != null && privilegeSet.contains("B6040")){%>  
        <tr> 
        	<td class="td_center"> 
        		<a onclick="page_agree()"><custom:button type="1" label="L_Agree" imgsrc="new.gif" border="0" style="width:60"/></a>
        		<a onclick="page_disagree()"><custom:button type="1" label="L_NotAgree" imgsrc="edit.gif" border="0" style="width:60"/></a>
        		<a onclick="page_update()"><custom:button type="1" label="L_Deny" imgsrc="delete.gif" border="0" style="width:60"/></a>
        		<a onclick="page_report()"><custom:button type="1" label="L_Import" imgsrc="delete.gif" border="0" style="width:60"/></a>        		
        	</td>
        </tr>
		<% } %>
  	</table>

   	</td>
</tr>
</table>
</form>
</body>
</html>


